<template>
  <view class="about-container">
    <!-- 页面头部 -->
    <view class="page-header">
      <view class="header-content">
        <text class="title">关于应用</text>
      </view>
    </view>

    <!-- 应用信息 -->
    <view class="app-info-section">
      <view class="info-card">
        <view class="app-logo">
          <image class="logo-image" src="/static/images/MEISHEN.png" mode="aspectFit"></image>
          <view class="logo-text">
            <text class="app-name">美申智控系统</text>
            <text class="app-version">版本 {{ appVersion }}</text>
          </view>
        </view>

        <view class="app-description">
          <text class="description-text">
            美申智控系统是专为便携式厕所物联网管理打造的智能平台，
            提供设备监控、告警管理、工单处理等全方位服务。
          </text>
        </view>
      </view>
    </view>

    <!-- 功能特色 -->
    <view class="features-section">
      <view class="section-title">功能特色</view>
      <view class="features-card">
        <view class="feature-item">
          <view class="feature-icon">📱</view>
          <view class="feature-content">
            <text class="feature-title">多端支持</text>
            <text class="feature-desc">支持微信小程序、H5网页、移动App</text>
          </view>
        </view>

        <view class="feature-item">
          <view class="feature-icon">🔔</view>
          <view class="feature-content">
            <text class="feature-title">智能告警</text>
            <text class="feature-desc">实时监控设备状态，智能推送告警信息</text>
          </view>
        </view>

        <view class="feature-item">
          <view class="feature-icon">📝</view>
          <view class="feature-content">
            <text class="feature-title">工单管理</text>
            <text class="feature-desc">完整的工单创建、分配、处理流程</text>
          </view>
        </view>

        <view class="feature-item">
          <view class="feature-icon">📊</view>
          <view class="feature-content">
            <text class="feature-title">数据统计</text>
            <text class="feature-desc">设备运行数据分析和报表生成</text>
          </view>
        </view>

        <view class="feature-item">
          <view class="feature-icon">🌐</view>
          <view class="feature-content">
            <text class="feature-title">物联网集成</text>
            <text class="feature-desc">MQTT协议支持，实时设备通信</text>
          </view>
        </view>
      </view>
    </view>

    <!-- 技术信息 -->
    <view class="tech-section">
      <view class="section-title">技术信息</view>
      <view class="tech-card">
        <view class="tech-item">
          <text class="tech-label">开发框架</text>
          <text class="tech-value">uni-app + Vue3 + TypeScript</text>
        </view>
        <view class="tech-item">
          <text class="tech-label">后端技术</text>
          <text class="tech-value">FastAPI + Python</text>
        </view>
        <view class="tech-item">
          <text class="tech-label">数据库</text>
          <text class="tech-value">MySQL + Redis</text>
        </view>
        <view class="tech-item">
          <text class="tech-label">通信协议</text>
          <text class="tech-value">MQTT + WebSocket</text>
        </view>
      </view>
    </view>

    <!-- 联系我们 -->
    <view class="contact-section">
      <view class="section-title">联系我们</view>
      <view class="contact-card">
        <view class="contact-item" @click="copyToClipboard('support@meishen.com')">
          <view class="contact-icon">📧</view>
          <view class="contact-content">
            <text class="contact-label">技术支持</text>
            <text class="contact-value">support@meishen.com</text>
          </view>
          <text class="copy-hint">点击复制</text>
        </view>

        <view class="contact-item" @click="makePhoneCall('400-123-4567')">
          <view class="contact-icon">📞</view>
          <view class="contact-content">
            <text class="contact-label">客服热线</text>
            <text class="contact-value">400-123-4567</text>
          </view>
          <text class="copy-hint">点击拨打</text>
        </view>

        <view class="contact-item" @click="copyToClipboard('www.meishen.com')">
          <view class="contact-icon">🌐</view>
          <view class="contact-content">
            <text class="contact-label">官方网站</text>
            <text class="contact-value">www.meishen.com</text>
          </view>
          <text class="copy-hint">点击复制</text>
        </view>
      </view>
    </view>

    <!-- 版权信息 -->
    <view class="copyright-section">
      <text class="copyright-text">© 2024 美申智控系统 版权所有</text>
      <text class="copyright-text">技术支持：美申科技</text>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from 'vue'

// 应用版本
const appVersion = ref('1.0.0')

// 复制到剪贴板
const copyToClipboard = (text: string) => {
  uni.setClipboardData({
    data: text,
    success: () => {
      uni.showToast({
        title: '已复制到剪贴板',
        icon: 'success'
      })
    },
    fail: () => {
      uni.showToast({
        title: '复制失败',
        icon: 'none'
      })
    }
  })
}

// 拨打电话
const makePhoneCall = (phoneNumber: string) => {
  uni.makePhoneCall({
    phoneNumber: phoneNumber,
    success: () => {
      console.log('拨打电话成功:', phoneNumber)
    },
    fail: () => {
      uni.showToast({
        title: '拨号失败',
        icon: 'none'
      })
    }
  })
}
</script>

<style lang="scss" scoped>
.about-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #f6ffed 0%, #e6f7ff 100%);
  padding-bottom: 40rpx;
}

// 页面头部
.page-header {
  background: linear-gradient(135deg, #52c41a, #73d13d);
  padding: 48rpx 32rpx 32rpx;
  color: #ffffff;

  .header-content {
    text-align: center;
  }

  .title {
    font-size: 36rpx;
    font-weight: bold;
  }
}

// 通用标题样式
.section-title {
  font-size: 32rpx;
  font-weight: bold;
  color: #333;
  margin: 32rpx 32rpx 24rpx;
  padding-left: 16rpx;
  border-left: 4rpx solid #52c41a;
}

// 应用信息
.app-info-section {
  padding: 0 32rpx;
  margin-top: -20rpx;

  .info-card {
    background: #ffffff;
    border-radius: 24rpx;
    padding: 48rpx 32rpx;
    box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
    text-align: center;

    .app-logo {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-bottom: 32rpx;

      .logo-image {
        width: 120rpx;
        height: 120rpx;
        border-radius: 24rpx;
        margin-bottom: 24rpx;
      }

      .logo-text {
        .app-name {
          display: block;
          font-size: 32rpx;
          font-weight: bold;
          color: #333;
          margin-bottom: 8rpx;
        }

        .app-version {
          font-size: 26rpx;
          color: #666;
        }
      }
    }

    .app-description {
      .description-text {
        font-size: 28rpx;
        color: #666;
        line-height: 1.6;
        text-align: left;
      }
    }
  }
}

// 功能特色
.features-section,
.tech-section,
.contact-section {
  padding: 0 32rpx;

  .features-card,
  .tech-card,
  .contact-card {
    background: #ffffff;
    border-radius: 24rpx;
    padding: 32rpx;
    box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
  }

  .feature-item,
  .tech-item,
  .contact-item {
    display: flex;
    align-items: center;
    padding: 24rpx 0;
    border-bottom: 1rpx solid #f8f8f8;
    transition: background-color 0.3s ease;

    &:last-child {
      border-bottom: none;
    }

    &:active {
      background-color: #f8f9fa;
    }

    .feature-icon,
    .contact-icon {
      font-size: 40rpx;
      margin-right: 24rpx;
      width: 48rpx;
      text-align: center;
    }

    .feature-content,
    .contact-content {
      flex: 1;

      .feature-title,
      .contact-label {
        display: block;
        font-size: 28rpx;
        color: #333;
        font-weight: 500;
        margin-bottom: 4rpx;
      }

      .feature-desc,
      .contact-value {
        font-size: 24rpx;
        color: #666;
      }
    }

    .tech-label {
      font-size: 28rpx;
      color: #666;
      width: 140rpx;
      flex-shrink: 0;
    }

    .tech-value {
      flex: 1;
      font-size: 28rpx;
      color: #333;
      font-weight: 500;
    }

    .copy-hint {
      font-size: 22rpx;
      color: #52c41a;
      margin-left: 16rpx;
    }
  }
}

// 版权信息
.copyright-section {
  padding: 32rpx;
  text-align: center;

  .copyright-text {
    display: block;
    font-size: 24rpx;
    color: #999;
    margin-bottom: 8rpx;
  }
}
</style>